package com.leetcode;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @author Dennis Li
 * @date 2020/9/2 20:35
 */
public class PutApple {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = "";
        while ((str = br.readLine()) != null) {
            String[] s = str.split(" ");
            int m = Integer.parseInt(s[0]);
            int n = Integer.parseInt(s[1]);
            System.out.println(deal(m, n));
        }
    }

    public static int deal(int m, int n) {
        if (m == 0 || n == 1) {
            return 1;
        } else if (n > m) {
            //n-(n-m)=n-n+m=m
            return deal(m, m);
        } else {
            return deal(m, n - 1) + deal(m - n, n);
        }
    }

}
